# eric7.Plugins.VcsPlugins.vcsGit.GitDiffGenerator

Module implementing a class to generate the output of the git diff command process.

### Global Attributes

None

### Classes

GitDiffGenerator | Class implementing the generation of output of the git diff command.

### Functions

None

## GitDiffGenerator

Class implementing the generation of output of the git diff command.

### Signals

finished()
  emitted when all processes have finished

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

GitDiffGenerator | Constructor
__procFinished | Private slot connected to the finished signal.
__processFileLine | Private slot to process a line giving the old/new file.
__processLine | Private method to process one line of output.
__readStderr | Private slot to handle the readyReadStandardError signal.
__readStdout | Private slot to handle the readyReadStandardOutput signal.
getResult | Public method to return the result data.
start | Public slot to start the git diff command.
stopProcesses | Public slot to stop the diff processes.

### Static Methods

None

#### GitDiffGenerator (Constructor)

GitDiffGenerator(vcs, parent=None)

Constructor

vcs (Git)
  reference to the vcs object
parent (QWidget)
  parent widget

#### GitDiffGenerator.__procFinished

__procFinished(_exitCode, _exitStatus)

Private slot connected to the finished signal.

_exitCode (int)
  exit code of the process (unused)
_exitStatus (QProcess.ExitStatus)
  exit status of the process (unused)

#### GitDiffGenerator.__processFileLine

__processFileLine(line, isTopDiff)

Private slot to process a line giving the old/new file.

line (str)
  line to be processed
isTopDiff (bool)
  flag indicating to show the output in the top output widget

#### GitDiffGenerator.__processLine

__processLine(line, isTopDiff)

Private method to process one line of output.

line (str)
  output line to process
isTopDiff (bool)
  flag indicating to show the output in the top output widget

#### GitDiffGenerator.__readStderr

__readStderr(process)

Private slot to handle the readyReadStandardError signal.

It reads the error output of the process and inserts it into the error pane.

process (QProcess)
  reference to the process providing error output

#### GitDiffGenerator.__readStdout

__readStdout(process)

Private slot to handle the readyReadStandardOutput signal.

It reads the output of the process, formats it and inserts it into the contents pane.

process (QProcess)
  reference to the process providing output

#### GitDiffGenerator.getResult

getResult()

Public method to return the result data.

Return:
  tuple of lists of string containing lines of the diff, the diff between stage and repo for 'work2stage2repo' mode (empty otherwise), the list of errors and a list of tuples of filenames and the line into the diff output.

Return Type:
  tuple of (list of str, list of str, list of str, list of (str, int))

#### GitDiffGenerator.start

start(fn, versions=None, diffMode="work2repo", stashName="")

Public slot to start the git diff command.

fn (str)
  filename to be diffed
versions (list of up to 2 str or None)
  list of versions to be diffed
diffMode (str)
  indication for the type of diff to be performed ( 'work2repo' compares the working tree with the HEAD commit, 'work2stage' compares the working tree with the staging area, 'stage2repo' compares the staging area with the HEAD commit, 'work2stage2repo' compares the working tree with the staging area and the staging area with the HEAD commit, 'stash' shows the diff for a stash)
stashName (str)
  name of the stash to show a diff for

Return:
  flag indicating the start status

Return Type:
  bool

Raises ValueError:
  raised to indicate a bad value for the 'diffMode' parameter.

#### GitDiffGenerator.stopProcesses

stopProcesses()

Public slot to stop the diff processes.

Up